<?php 
class teacher_Model_DbTable_DbAvaliableTime extends Zend_Db_Table_Abstract{
	protected $_name = "tbl_avaliable_time_teacher";
	
	function gettime()
	{
		$db = new Application_Model_DbTable_DbGlobal();
		$sql ="SELECT 
				  tvt.`avaliable_id`,
				  tvt.`t_id`,
				  tvt.`academic_year`,
				  tvt.`semester_id`,
				  tvt.`created_date`,
				  t.`teacher_id`,
				  t.`teacher_name`
				FROM
				  `tb_avaliable_time_store` AS tvt ,`tbl_teacher` AS t WHERE t.`teacher_id`=tvt.`t_id`";
		return $db->getGlobalDb($sql);
	}
	
	public function InsertAvaliableTime($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$avaliable = array(
					"t_id"			=>$data["teacher"],
					"academic_year" =>$data["academic_year"],
					"semester_id"	=>$data["semester"],
					"created_date"	=> new Zend_Date(),
					"valid_date"	=> 2014,
				);
		$this->_name = "tb_avaliable_time_store";
		$avaliable_time = $this->insert($avaliable);
		$arr_1 = array(
				"avaliable_id"	=>	$avaliable_time,
				"t_id" 			=> 	$data["teacher"],
				"mon_7_8"  		=> 	$data["check_7_8_mon"],
				"mon_8_10" 		=> 	$data["check_8_10_mon"],
				"mon_10_12" 	=> 	$data["check_10_12_mon"],
				"mon_1_2"		=> 	$data["check_1_2_mon"],
				"mon_2_4"		=> 	$data["check_2_4_mon"],
				"mon_4_5"		=> 	$data["check_4_5_mon"],
				"mon_5_7"		=> 	$data["check_5_7_mon"],
				"mon_7_8_1"		=> 	$data["check_7_8_1_mon"],
				"tur_7_8"		=> 	$data["check_7_8_tur"],
				"tur_8_10"		=> 	$data["check_8_10_tur"],
				"tur_10_12"		=> 	$data["check_10_12_tur"],
				"tur_1_2"		=> 	$data["check_1_2_tur"],
				"tur_2_4"		=> 	$data["check_2_4_tur"],
				"tur_4_5"		=> 	$data["check_4_5_tur"],
				"tur_5_7"		=> 	$data["check_5_7_tur"],
				"tur_7_8_1"		=> 	$data["check_7_8_1_tur"],
				"wed_7_8"		=> 	$data["check_7_8_wed"],
				"wed_8_10"		=> 	$data["check_8_10_wed"],
				"wed_10_12"		=> 	$data["check_10_12_wed"],
				"wed_1_2"		=> 	$data["check_1_2_wed"],
				"wed_2_4"		=> 	$data["check_2_4_wed"],
				"wed_4_5"		=> 	$data["check_4_5_wed"],
				"wed_5_7"		=> 	$data["check_5_7_wed"],
				"wed_7_8_1"		=> 	$data["check_7_8_1_wed"],
				"thu_7_8"		=> 	$data["check_7_8_thu"],
				"thu_8_10"		=> 	$data["check_8_10_thu"],
				"thu_10_12"		=> 	$data["check_10_12_thu"],
				"thu_1_2"		=> 	$data["check_1_2_thu"],
				"thu_2_4"		=> 	$data["check_2_4_thu"],
				"thu_4_5"		=> 	$data["check_4_5_thu"],
				"thu_5_7"		=> 	$data["check_5_7_thu"],
				"thu_7_8_1"		=> 	$data["check_7_8_1_thu"],
				"fri_7_8"		=> 	$data["check_7_8_fri"],
				"fri_8_10"		=> 	$data["check_8_10_fri"],
				"fri_10_12"		=> 	$data["check_10_12_fri"],
				"fri_1_2"		=> 	$data["check_1_2_fri"],
				"fri_2_4"		=> 	$data["check_2_4_fri"],
				"fri_4_5"		=> 	$data["check_4_5_fri"],
				"fri_5_7"		=> 	$data["check_5_7_fri"],
				"fri_7_8_1"		=> 	$data["check_7_8_1_fri"],
				"sat_7_8"		=> 	$data["check_7_8_sat"],
				"sat_8_10"		=> 	$data["check_8_10_sat"],
				"sat_10_12"		=> 	$data["check_10_12_sat"],
				"sat_1_2"		=> 	$data["check_1_2_sat"],
				"sat_2_4"		=> 	$data["check_2_4_sat"],
				"sat_4_5"		=> 	$data["check_4_5_sat"],
				"sat_5_7"		=> 	$data["check_5_7_sat"],
				"sat_7_8_1"		=> 	$data["check_7_8_1_sat"],
				"sun_7_8"		=> 	$data["check_7_8_sun"],
				"sun_8_10"		=> 	$data["check_8_10_sun"],
				"sun_10_12"		=> 	$data["check_10_12_sun"],
				"sun_1_2"		=> 	$data["check_1_2_sun"],
				"sun_2_4"		=> 	$data["check_2_4_sun"],
				"sun_4_5"		=> 	$data["check_4_5_sun"],
				"sun_5_7"		=> 	$data["check_5_7_sun"],
				"sun_7_8_1"		=> 	$data["check_7_8_1_sun"],
				"created_date"		=>  date("Y-m-d H:s:i"),
				"last_mod_date"		=> 	date("Y-m-d H:s:i"),
				
				);
		$this->_name = "tbl_avaliable_time_teacher";
		$arr1 = $this->insert($arr_1);
		unset($arr_1);
		$db->commit();
}
	/////
	public function check_7_8_mon($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		foreach ($result as $rs){
			$day1 = array(
					"avaliable_id"	=>$rs,
					"t_id" 			=> $data["teacher"],
					"day_id"  		=> 1,
					"time_id"		=>1,
					"date"			=> new Zend_Date(),
			);
		}
		//print_r($day1);
		$this->_name = "tbl_teacher_available_day_time";
		$this->insert($day1);
		$db->commit();
	}
	public function check_7_8_tur($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day9 = array(
				"avaliable_id"	=>$rs,
					"t_id" 		=> $data["teacher"],
					"day_id"  	=> 2,
					"time_id"	=>1,
					"date"		=> new Zend_Date(),
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day9);
		}
		$db->commit();
	}
	public function check_7_8_wed($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day17 = array(
				"avaliable_id"	=>$rs,
				"t_id" 			=> $data["teacher"],
				"day_id"  		=> 3,
				"time_id"		=>1,
				"date"			=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day17);
			}
			$db->commit();
	}
	public function check_7_8_thu($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
	
		$day25 = array(
				"avaliable_id"	=>$rs,
				"t_id" 			=> $data["teacher"],
				"day_id"  		=> 4,
				"time_id"		=>1,
				"date"			=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day25);
			}
			$db->commit();
	}
	public function check_7_8_fri($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
	
		$day33 = array(
				"avaliable_id"	=>$rs,
				"t_id" 			=> $data["teacher"],
				"day_id"  		=> 5,
				"time_id"		=>1,
				"date"			=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day33);
			}
			$db->commit();
	}
	public function check_7_8_sat($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){

		$day41 = array(
				"avaliable_id"	=>$rs,
				"t_id" 			=> $data["teacher"],
				"day_id"  		=> 6,
				"time_id"		=>1,
				"date"			=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day41);
			}
			$db->commit();
	}
	public function check_7_8_sun($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day49 = array(
				"avaliable_id"	=>$rs,
				"t_id" 			=> $data["teacher"],
				"day_id"  		=> 7,
				"time_id"		=>1,
				"date"			=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day49);
			}
			$db->commit();
	}
	public function check_8_10_mon($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day2 = array(
				"avaliable_id"	=>$rs,
				"t_id" 			=> $data["teacher"],
				"day_id"  		=> 1,
				"time_id"		=>2,
				"date"			=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day2);
			}
			$db->commit();
	}
	public function check_8_10_tur($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day10 = array(
				"avaliable_id"	=>$rs,
				"t_id" 			=> $data["teacher"],
				"day_id"  		=> 2,
				"time_id"		=>2,
				"date"			=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day10);
			}
			$db->commit();
	}
	public function check_8_10_wed($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day18 = array(
				"avaliable_id"	=>$rs,
				"t_id" 			=> $data["teacher"],
				"day_id"  		=> 3,
				"time_id"		=>2,
				"date"			=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day18);
			}
			$db->commit();
	}
	public function check_8_10_thu($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day26 = array(
				"avaliable_id"	=>$rs,
				"t_id" 			=> $data["teacher"],
				"day_id"  		=> 4,
				"time_id"		=>2,
				"date"			=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day26);
			}
			$db->commit();
	}
	public function check_8_10_fri($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day34 = array(
				"avaliable_id"	=>$rs,
				"t_id" 			=> $data["teacher"],
				"day_id"  		=> 5,
				"time_id"		=>2,
				"date"			=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day34);
			}
			$db->commit();
	}
	public function check_8_10_sat($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day42 = array(
				"avaliable_id"	=>$rs,
				"t_id" 			=> $data["teacher"],
				"day_id"  		=> 6,
				"time_id"		=>2,
				"date"			=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day42);
			}
			$db->commit();
	}
	public function check_8_10_sun($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day49 = array(
				"avaliable_id"	=>$rs,
				"t_id" 			=> $data["teacher"],
				"day_id"  		=> 7,
				"time_id"		=>2,
				"date"			=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day49);
			}
			$db->commit();
	}
	public function check_10_12_mon($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day3 = array(
				"avaliable_id"	=>$rs,
				"t_id" 			=> $data["teacher"],
				"day_id"  		=> 1,
				"time_id"		=>3,
				"date"			=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day3);
			}
			$db->commit();
	}
	public function check_10_12_tur($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day11 = array(
				"avaliable_id"	=>$rs,
				"t_id" 			=> $data["teacher"],
				"day_id"  		=> 2,
				"time_id"		=>3,
				"date"			=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day11);
			}
			$db->commit();
	}
	public function check_10_12_wed($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day19 = array(
				"avaliable_id"	=>$rs,
				"t_id" 			=> $data["teacher"],
				"day_id"  		=> 3,
				"time_id"		=>3,
				"date"			=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day19);
			}
			$db->commit();
	}
	public function check_10_12_thu($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day27 = array(
				"avaliable_id"	=>$rs,
				"t_id" 			=> $data["teacher"],
				"day_id"  		=> 4,
				"time_id"		=>3,
				"date"			=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day27);
			}
			$db->commit();
	}
	public function check_10_12_fri($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day35 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 5,
				"time_id"	=>3,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day35);
			}
			$db->commit();
	}
	public function check_10_12_sat($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day43 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 6,
				"time_id"	=>3,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day43);
			}
			$db->commit();
	}
	public function check_10_12_sun($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day51 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 7,
				"time_id"	=>3,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day51);
			}
			$db->commit();
	}
	public function check_1_2_mon($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day4 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 1,
				"time_id"	=>4,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day4);
			}
			$db->commit();
	}
	public function check_1_2_tur($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day12 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 2,
				"time_id"	=>4,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day12);
			}
			$db->commit();
	}
	public function check_1_2_wed($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day20 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 3,
				"time_id"	=>4,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day20);
			}
			$db->commit();
	}
	public function check_1_2_thu($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day28 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 4,
				"time_id"	=>4,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day28);
			}
			$db->commit();
	}
	public function check_1_2_fri($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day36 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 5,
				"time_id"	=>4,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day36);
			}
			$db->commit();
	}
	public function check_1_2_sat($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day44 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 6,
				"time_id"	=>4,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day44);
			}
			$db->commit();
	}
	public function check_1_2_sun($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day52 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 7,
				"time_id"	=>4,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day52);
			}
			$db->commit();
	}
	public function check_2_4_mon($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day5 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 1,
				"time_id"	=>5,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day5);
			}
			$db->commit();
	}
	public function check_2_4_tur($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day13 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 2,
				"time_id"	=>5,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day13);
			}
			$db->commit();
		///**
	}
	public function check_2_4_wed($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day21 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 3,
				"time_id"	=>5,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day21);
			}
			$db->commit();
	}
	public function check_2_4_thu($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day29 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 4,
				"time_id"	=>5,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day29);
			}
			$db->commit();
	}
	public function check_2_4_fri($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day37 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 5,
				"time_id"	=>5,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day37);
			}
			$db->commit();
	}
	public function check_2_4_sat($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day45 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 6,
				"time_id"	=>5,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day45);
			}
			$db->commit();
	}
	public function check_2_4_sun($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day53 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 7,
				"time_id"	=>5,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day53);
			}
			$db->commit();
	}
	public function check_4_5_mon($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day6 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 1,
				"time_id"	=>6,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day6);
			}
			$db->commit();
	}
	public function check_4_5_tur($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day14 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 2,
				"time_id"	=>6,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day14);
			}
			$db->commit();
	}
	public function check_4_5_wed($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day22 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 3,
				"time_id"	=>6,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day22);
			}
			$db->commit();
	}
	public function check_4_5_thu($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day30 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 4,
				"time_id"	=>6,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day30);
			}
			$db->commit();
	}
	public function check_4_5_fri($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day38 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 5,
				"time_id"	=>6,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day38);
			}
			$db->commit();
	}
	public function check_4_5_sat($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day46 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 6,
				"time_id"	=>6,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day46);
			}
			$db->commit();
	}
	public function check_4_5_sun($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day54 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 7,
				"time_id"	=>6,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day54);
			}
			$db->commit();
	}
	public function check_5_7_mon($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day7 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 1,
				"time_id"	=>7,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day7);
			}
			$db->commit();
	}
	public function check_5_7_tur($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day15 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 2,
				"time_id"	=>7,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day15);
			}
			$db->commit();
	}
	public function check_5_7_wed($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day23 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 3,
				"time_id"	=>7,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day23);
			}
			$db->commit();
	}
	public function check_5_7_thu($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day31 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 4,
				"time_id"	=>7,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day31);
			}
			$db->commit();
	}
	public function check_5_7_fri($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day39 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 5,
				"time_id"	=>7,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day39);
			}
			$db->commit();
	}
	public function check_5_7_sat($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day47 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 6,
				"time_id"	=>7,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day47);
			}
			$db->commit();
	}
	public function check_5_7_sun($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day55 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 7,
				"time_id"	=>7,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day55);
			}
			$db->commit();
	}
	public function check_7_8_1_mon($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day8 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 1,
				"time_id"	=>8,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day8);
			}
			$db->commit();
	}
	public function check_7_8_1_tur($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day16 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 2,
				"time_id"	=>8,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day16);
			}
			$db->commit();
	}
	public function check_7_8_1_wed($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day24 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 3,
				"time_id"	=>8,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day24);
			}
			$db->commit();
	}
	public function check_7_8_1_thu($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day32 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 4,
				"time_id"	=>8,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day32);
			}
			$db->commit();
	}
	public function check_7_8_1_fri($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day40 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 5,
				"time_id"	=>8,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day40);
			}
			$db->commit();
	}
	public function check_7_8_1_sat($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day48 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 6,
				"time_id"	=>8,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day48);
		}
		$db->commit();
	}
	public function check_7_8_1_sun($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$sql = "select MAX(avaliable_id) from tb_avaliable_time_store";
		$result=$db->fetchRow($sql);
		print_r($result);//exit();
		foreach ($result as $rs){
		$day56 = array(
				"avaliable_id"	=>$rs,
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 7,
				"time_id"	=>8,
				"date"		=> new Zend_Date(),
					
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day56);
		}
		$db->commit();
	}
	// Update time
	
	////////
	public function UpdateAvaliableTime($data){
		$db = $this->getAdapter();
		
		$avaliable = array(
				"t_id"	=>$data["teacher"],
				"academic_year" =>$data["academic_year"],
				"semester_id"	=>$data["semester"],
				"created_date"	=> new Zend_Date(),
				"valid_date"	=> 2014,
				//"semester_id"	=>1,
				//"date"	=> new Zend_Date()
		);
		$this->_name = "tb_avaliable_time_store";
		$where = $this->getAdapter()->quoteInto("avaliable_id=?", $data['id']);
		$avaliable_time = $this->update($avaliable, $where);
		
		$arr_1 = array(
				"avaliable_id"	=>  $data["id"],
				"t_id" 			=>  $data["teacher"],
				"mon_7_8"  		=> 	$data["check_7_8_mon"],
				"mon_8_10" 		=> 	$data["check_8_10_mon"],
				"mon_10_12" 	=> 	$data["check_10_12_mon"],
				"mon_1_2"		=> 	$data["check_1_2_mon"],
				"mon_2_4"		=> 	$data["check_2_4_mon"],
				"mon_4_5"		=> 	$data["check_4_5_mon"],
				"mon_5_7"		=> 	$data["check_5_7_mon"],
				"mon_7_8_1"		=> 	$data["check_7_8_1_mon"],
				"tur_7_8"		=> 	$data["check_7_8_tur"],
				"tur_8_10"		=> 	$data["check_8_10_tur"],
				"tur_10_12"		=> 	$data["check_10_12_tur"],
				"tur_1_2"		=> 	$data["check_1_2_tur"],
				"tur_2_4"		=> 	$data["check_2_4_tur"],
				"tur_4_5"		=> 	$data["check_4_5_tur"],
				"tur_5_7"		=> 	$data["check_5_7_tur"],
				"tur_7_8_1"		=> 	$data["check_7_8_1_tur"],
				"wed_7_8"		=> 	$data["check_7_8_wed"],
				"wed_8_10"		=> 	$data["check_8_10_wed"],
				"wed_10_12"		=> 	$data["check_10_12_wed"],
				"wed_1_2"		=> 	$data["check_1_2_wed"],
				"wed_2_4"		=> 	$data["check_2_4_wed"],
				"wed_4_5"		=> 	$data["check_4_5_wed"],
				"wed_5_7"		=> 	$data["check_5_7_wed"],
				"wed_7_8_1"		=> 	$data["check_7_8_1_wed"],
				"thu_7_8"		=> 	$data["check_7_8_thu"],
				"thu_8_10"		=> 	$data["check_8_10_thu"],
				"thu_10_12"		=> 	$data["check_10_12_thu"],
				"thu_1_2"		=> 	$data["check_1_2_thu"],
				"thu_2_4"		=> 	$data["check_2_4_thu"],
				"thu_4_5"		=> 	$data["check_4_5_thu"],
				"thu_5_7"		=> 	$data["check_5_7_thu"],
				"thu_7_8_1"		=> 	$data["check_7_8_1_thu"],
				"fri_7_8"		=> 	$data["check_7_8_fri"],
				"fri_8_10"		=> 	$data["check_8_10_fri"],
				"fri_10_12"		=> 	$data["check_10_12_fri"],
				"fri_1_2"		=> 	$data["check_1_2_fri"],
				"fri_2_4"		=> 	$data["check_2_4_fri"],
				"fri_4_5"		=> 	$data["check_4_5_fri"],
				"fri_5_7"		=> 	$data["check_5_7_fri"],
				"fri_7_8_1"		=> 	$data["check_7_8_1_fri"],
				"sat_7_8"		=> 	$data["check_7_8_sat"],
				"sat_8_10"		=> 	$data["check_8_10_sat"],
				"sat_10_12"		=> 	$data["check_10_12_sat"],
				"sat_1_2"		=> 	$data["check_1_2_sat"],
				"sat_2_4"		=> 	$data["check_2_4_sat"],
				"sat_4_5"		=> 	$data["check_4_5_sat"],
				"sat_5_7"		=> 	$data["check_5_7_sat"],
				"sat_7_8_1"		=> 	$data["check_7_8_1_sat"],
				"sun_7_8"		=> 	$data["check_7_8_sun"],
				"sun_8_10"		=> 	$data["check_8_10_sun"],
				"sun_10_12"		=> 	$data["check_10_12_sun"],
				"sun_1_2"		=> 	$data["check_1_2_sun"],
				"sun_2_4"		=> 	$data["check_2_4_sun"],
				"sun_4_5"		=> 	$data["check_4_5_sun"],
				"sun_5_7"		=> 	$data["check_5_7_sun"],
				"sun_7_8_1"		=> 	$data["check_7_8_1_sun"],
				"created_date"		=>  date("Y-m-d H:s:i"),
				"last_mod_date"		=> 	date("Y-m-d H:s:i"),
	
		);
		$this->_name = "tbl_avaliable_time_teacher";
		$where= $this->getAdapter()->quoteInto("id=?", $data['ids']);
		$update=$this->update($arr_1, $where);
		
		$sql ="DELETE FROM tbl_teacher_available_day_time WHERE avaliable_id =".$data["id"];
		$db->query($sql);
	}
	public function update_check_7_8_mon($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
	
		$day1 = array(
				"avaliable_id"	=>$data["id"],
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 1,
				"time_id"	=>1,
				"date"		=> new Zend_Date(),
		);
	
		//print_r($day1);
		$this->_name = "tbl_teacher_available_day_time";
		$this->insert($day1);
		$db->commit();
	}
	public function update_check_7_8_tur($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
		$day9 = array(
				"avaliable_id"	=>$data["id"],
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 2,
				"time_id"	=>1,
				"date"		=> new Zend_Date(),
		);
		$this->_name = "tbl_teacher_available_day_time";
		$this->insert($day9);
	
		$db->commit();
	}
	public function update_check_7_8_wed($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
	
		$day17 = array(
				"avaliable_id"	=>$data["id"],
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 3,
				"time_id"	=>1,
				"date"		=> new Zend_Date(),
					
		);
		$this->_name = "tbl_teacher_available_day_time";
		$this->insert($day17);
	
		$db->commit();
	}
	public function update_check_7_8_thu($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
	
		$day25 = array(
				"avaliable_id"	=>$data["id"],
				"t_id" 		=> $data["teacher"],
				"day_id"  	=> 4,
				"time_id"	=>1,
				"date"		=> new Zend_Date(),
					
		);
		$this->_name = "tbl_teacher_available_day_time";
		$this->insert($day25);
	
		$db->commit();
	}
	public function update_check_7_8_fri($data){
		$db = $this->getAdapter();
		$db->beginTransaction();
	
	
			$day33 = array(
					"avaliable_id"	=>$data["id"],
					"t_id" 		=> $data["teacher"],
					"day_id"  	=> 5,
					"time_id"	=>1,
					"date"		=> new Zend_Date(),
						
			);
			$this->_name = "tbl_teacher_available_day_time";
			$this->insert($day33);
	
			$db->commit();
		}
		public function update_check_7_8_sat($data){
			$db = $this->getAdapter();
			$db->beginTransaction();
	
	
				$day41 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 6,
						"time_id"	=>1,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day41);
	
				$db->commit();
			}
			public function update_check_7_8_sun($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day49 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 7,
						"time_id"	=>1,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day49);
	
				$db->commit();
			}
			public function update_check_8_10_mon($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day2 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 1,
						"time_id"	=>2,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day2);
	
				$db->commit();
			}
			public function update_check_8_10_tur($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day10 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 2,
						"time_id"	=>2,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day10);
	
				$db->commit();
			}
			public function update_check_8_10_wed($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day18 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 3,
						"time_id"	=>2,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day18);
	
				$db->commit();
			}
			public function update_check_8_10_thu($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day26 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 4,
						"time_id"	=>2,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day26);
	
				$db->commit();
			}
			public function update_check_8_10_fri($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day34 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 5,
						"time_id"	=>2,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day34);
	
				$db->commit();
			}
			public function update_check_8_10_sat($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day42 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 6,
						"time_id"	=>2,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day42);
	
				$db->commit();
			}
			public function update_check_8_10_sun($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day49 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 7,
						"time_id"	=>2,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day49);
	
				$db->commit();
			}
			public function update_check_10_12_mon($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day3 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 1,
						"time_id"	=>3,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day3);
	
				$db->commit();
			}
			public function update_check_10_12_tur($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day11 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 2,
						"time_id"	=>3,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day11);
	
				$db->commit();
			}
			public function update_check_10_12_wed($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day19 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 3,
						"time_id"	=>3,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day19);
	
				$db->commit();
			}
			public function update_check_10_12_thu($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day27 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 4,
						"time_id"	=>3,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day27);
	
				$db->commit();
			}
			public function update_check_10_12_fri($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day35 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 5,
						"time_id"	=>3,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day35);
	
				$db->commit();
			}
			public function update_check_10_12_sat($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day43 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 6,
						"time_id"	=>3,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day43);
	
				$db->commit();
			}
			public function update_check_10_12_sun($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day51 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 7,
						"time_id"	=>3,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day51);
	
				$db->commit();
			}
			public function update_check_1_2_mon($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day4 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 1,
						"time_id"	=>4,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day4);
	
				$db->commit();
			}
			public function update_check_1_2_tur($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day12 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 2,
						"time_id"	=>4,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day12);
	
				$db->commit();
			}
			public function update_check_1_2_wed($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day20 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 3,
						"time_id"	=>4,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day20);
	
				$db->commit();
			}
			public function update_check_1_2_thu($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day28 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 4,
						"time_id"	=>4,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day28);
	
				$db->commit();
			}
			public function update_check_1_2_fri($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day36 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 5,
						"time_id"	=>4,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day36);
	
				$db->commit();
			}
			public function update_check_1_2_sat($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day44 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 6,
						"time_id"	=>4,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day44);
	
				$db->commit();
			}
			public function update_check_1_2_sun($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day52 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 7,
						"time_id"	=>4,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day52);
	
				$db->commit();
			}
			public function update_check_2_4_mon($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day5 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 1,
						"time_id"	=>5,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day5);
	
				$db->commit();
			}
			public function update_check_2_4_tur($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day13 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 2,
						"time_id"	=>5,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day13);
	
				$db->commit();
				///**
			}
			public function update_check_2_4_wed($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day21 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 3,
						"time_id"	=>5,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day21);
	
				$db->commit();
			}
			public function update_check_2_4_thu($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day29 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 4,
						"time_id"	=>5,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day29);
	
				$db->commit();
			}
			public function update_check_2_4_fri($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day37 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 5,
						"time_id"	=>5,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day37);
	
				$db->commit();
			}
			public function update_check_2_4_sat($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day45 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 6,
						"time_id"	=>5,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day45);
	
				$db->commit();
			}
			public function update_check_2_4_sun($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day53 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 7,
						"time_id"	=>5,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day53);
	
				$db->commit();
			}
			public function update_check_4_5_mon($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day6 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 1,
						"time_id"	=>6,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day6);
	
				$db->commit();
			}
			public function update_check_4_5_tur($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day14 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 2,
						"time_id"	=>6,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day14);
	
				$db->commit();
			}
			public function update_check_4_5_wed($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day22 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 3,
						"time_id"	=>6,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day22);
	
				$db->commit();
			}
			public function update_check_4_5_thu($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day30 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 4,
						"time_id"	=>6,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day30);
	
				$db->commit();
			}
			public function update_check_4_5_fri($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day38 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 5,
						"time_id"	=>6,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day38);
	
				$db->commit();
			}
			public function update_check_4_5_sat($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day46 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 6,
						"time_id"	=>6,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day46);
	
				$db->commit();
			}
			public function update_check_4_5_sun($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day54 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 7,
						"time_id"	=>6,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day54);
	
				$db->commit();
			}
			public function update_check_5_7_mon($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day7 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 1,
						"time_id"	=>7,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day7);
	
				$db->commit();
			}
			public function update_check_5_7_tur($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day15 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 2,
						"time_id"	=>7,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day15);
	
				$db->commit();
			}
			public function update_check_5_7_wed($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day23 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 3,
						"time_id"	=>7,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day23);
	
				$db->commit();
			}
			public function update_check_5_7_thu($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day31 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 4,
						"time_id"	=>7,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day31);
	
				$db->commit();
			}
			public function update_check_5_7_fri($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day39 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 5,
						"time_id"	=>7,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day39);
	
				$db->commit();
			}
			public function update_check_5_7_sat($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day47 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 6,
						"time_id"	=>7,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day47);
	
				$db->commit();
			}
			public function update_check_5_7_sun($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day55 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 7,
						"time_id"	=>7,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day55);
	
				$db->commit();
			}
			public function update_check_7_8_1_mon($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day8 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 1,
						"time_id"	=>8,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day8);
	
				$db->commit();
			}
			public function update_check_7_8_1_tur($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day16 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 2,
						"time_id"	=>8,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day16);
	
				$db->commit();
			}
			public function update_check_7_8_1_wed($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day24 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 3,
						"time_id"	=>8,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day24);
	
				$db->commit();
			}
			public function update_check_7_8_1_thu($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day32 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 4,
						"time_id"	=>8,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day32);
	
				$db->commit();
			}
			public function update_check_7_8_1_fri($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day40 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 5,
						"time_id"	=>8,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day40);
	
				$db->commit();
			}
			public function update_check_7_8_1_sat($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day48 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 6,
						"time_id"	=>8,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day48);
	
				$db->commit();
			}
			public function update_check_7_8_1_sun($data){
				$db = $this->getAdapter();
				$db->beginTransaction();
	
				$day56 = array(
						"avaliable_id"	=>$data["id"],
						"t_id" 		=> $data["teacher"],
						"day_id"  	=> 7,
						"time_id"	=>8,
						"date"		=> new Zend_Date(),
							
				);
				$this->_name = "tbl_teacher_available_day_time";
				$this->insert($day56);
	
				$db->commit();
			}	

	//////////////////////////////////////////////////////////////////
	///////////////////////////////////////////////////////////////////
	function getAvailableTime()
	{
		$db = new Application_Model_DbTable_DbGlobal();
		//$db = $this->getAdapter();
		$sql = "SELECT * FROM tbl_avaliable_time_teacher";
		return $db->getGlobalDb($sql);
	}
	/////////////////////////////////////////////////////////
	public function getAvailableTimeByID($available){
		$db = $this->getAdapter();
		$sql = "SELECT 
				  tat.`avaliable_id`,
				  tat.`t_id` AS teacher_id,
				  tat.`academic_year`,
  				  tat.`semester_id`,
				  tatt.*,
				  t.* 
				FROM
				  `tb_avaliable_time_store` AS tat,
				  `tbl_teacher` AS t,
				  `tbl_avaliable_time_teacher` AS tatt 
				WHERE tat.`t_id` = t.`teacher_id` 
				  AND tatt.`avaliable_id` = tat.`avaliable_id` 
				  AND tat.`avaliable_id` ='".$available."'LIMIT 1";
		// 		$select = $this->select();
		// 		$select->from($this,'dpt_id')->where('dpt_name=?',$dptname);
		$row = $db->fetchRow($sql);
		//if(!$row) return NULL;
		return $row;
	}
	public function getTimeByID($time){
		$db = $this->getAdapter();
		$sql = "select *from tb_avaliable_time_store where avaliable_id='".$time."' LIMIT 1";
		$row = $db->fetchRow($sql);
		return $row;
	}
	
	
}